package com.yj.daily.designpatterns.builder;

public class HeadingBuilder {

    public static String headingBuilder(String line){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < line.length() ; i++) {
            if (line.charAt(i) == '#'){
                String format = String.format("<h>%s</h>", line.charAt(i));
                line = line.substring(i);
                sb.append(format);
            }
            sb.append(line.charAt(i));
        }

        return  sb.toString();
    }

    public static void main(String[] args) {
        String s = headingBuilder("1#abc");
        System.out.println(s);
    }
}
